using NHibernate;
using Microsoft.Extensions.Logging;
using System.Data.Entity.Infrastructure;

namespace Crux.Core.NHibernate.Test;
/// <summary>
/// MicrosoftLoggerFactory
/// </summary>
public class MicrosoftLoggerFactory : INHibernateLoggerFactory
{
    private readonly Microsoft.Extensions.Logging.ILoggerFactory _factory;

    public MicrosoftLoggerFactory(Microsoft.Extensions.Logging.ILoggerFactory factory)
    {
        _factory = factory;
    }

    #region ILoggerFactory

    public INHibernateLogger LoggerFor(string keyName)
    {
        return new MicrosoftLogger(_factory.CreateLogger(keyName));
    }

    public INHibernateLogger LoggerFor(System.Type type)
    {
        return new MicrosoftLogger(_factory.CreateLogger(type));
    }

    #endregion
}